package university.dropcourse.conversion;

import javax.ejb.LocalBean;
import javax.ejb.Stateless;

import university.dropcourse.dto.MaterialeDto;
import university.dropcourse.entity.Materiale;


/**
 * Generated class university.dropcourse.conv.MaterialeConv
 */
@LocalBean
@Stateless
public class MaterialeConv {

    private static final long serialVersionUID = 1L;

    public MaterialeConv() { }

    public MaterialeDto fromEntity(Materiale in) {
        MaterialeDto result = new MaterialeDto();
        
        result.setCorsoId(in.getCorso().getId());
        result.setDecrizione(in.getDecrizione());
        result.setId(in.getId());
        result.setLink(in.getLink());
        result.setNome(in.getNome());
        result.setTipo(in.getTipo());

        return result;
    }

    public Materiale fromDto(MaterialeDto in) {
        Materiale result = new Materiale();
        
        result.setCorso(null);
        result.setDecrizione(in.getDecrizione());
        result.setId(in.getId());
        result.setLink(in.getLink());
        result.setNome(in.getNome());
        result.setTipo(in.getTipo());

        return result;
    }

}